package com.example.demo.controller;

import com.example.demo.entity.dto.ResultBean;
import com.example.demo.service.AgentService;
import com.example.demo.service.PlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/agent")
public class AgentController {
    @Autowired
    private AgentService agentService;

    /**
     * 查询分页数据
     */
    @RequestMapping(method = RequestMethod.GET, value = "/normal")
    public ResultBean<?> listByPage(@RequestParam(name = "page", defaultValue = "1") int page,
                                    @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
                                    @RequestParam(name = "company",defaultValue = "") String company,
                                    @RequestParam(name = "education",defaultValue = "") String education,
                                    @RequestParam(name = "profession",defaultValue = "") String profession   ) {
        return new ResultBean<>(agentService.listAgentsByPage(page,pageSize,company,education,profession));
    }

    /**
     * 查询单个
     */
    @RequestMapping(method = RequestMethod.GET, value = "/normal/{id}")
    public ResultBean<?> getById(@PathVariable("id") Integer id) {
        return new ResultBean<>(agentService.getById(id));
    }
}
